﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace TransCode.Player.ImagePage
{
    /// <summary>
    /// Interaction logic for QueryDefault.xaml
    /// </summary>
    public partial class QueryDefault : UserControl
    {
        public QueryDefault()
        {
            InitializeComponent();

            beginPicker.SelectedDate = DateTime.Now.AddDays(-1);
            endPicker.SelectedDate = DateTime.Now.AddDays(1) ;
        }

        private void btnQuery_Click(object sender, RoutedEventArgs e)
        {
            Query();
        }

        private void Query()
        {
            if (beginPicker.SelectedDate.HasValue && endPicker.SelectedDate.HasValue)
            {
                IDictionary<string, object> queryArgs = new Dictionary<string, object>();
                queryArgs["BeginTime"] = beginPicker.SelectedDate.Value;
                queryArgs["EndTime"] = endPicker.SelectedDate.Value;
                queryArgs["VideoName"] = videoName.Text;

                if (Common.ImageMainPage != null)
                    Common.ImageMainPage.Query(queryArgs);
            }
        }
         
    }
}
